package com.monster.service;

import com.monster.dao.UserLikeDao;
import com.monster.dao.UserLikeDaoImpl;
/**
 * 用户收藏ServiceImpl
 * @author lym
 */
public class UserLikeServiceImpl implements UserLikeService{
    private UserLikeDao userLikeDao = new UserLikeDaoImpl();
    //查询某收藏是否存在
    /**
     * 通过用户id,收藏类型，收藏对应的ID
     * @param userId
     * @param likeType
     * @param likeId
     * @return 如果存在就返回1
     */
    @Override
    public int getLikeCountByID(Long userId, int likeType, Long likeId) {
        return userLikeDao.getLikeCountByID(userId,likeType,likeId);
    }
    //添加收藏
    /**
     * 通过用户id,收藏类型，收藏对应的ID添加收藏
     * @param userId
     * @param likeType
     * @param likeId
     * @return 添加成功返回1
     */
    @Override
    public int addLikeByID(Long userId, int likeType, Long likeId) {
        return userLikeDao.addLikeByID(userId,likeType,likeId);
    }
    //取消收藏
    /**
     * 通过用户id,收藏类型，收藏对应的ID删除收藏
     * @param userId
     * @param likeType
     * @param likeId
     * @return 添加成功返回1
     */
    @Override
    public int deleteLikeById(Long userId, int likeType, Long likeId) {
        return userLikeDao.deleteLikeById(userId,likeType,likeId);
    }
}
